home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-11 / kgclock.zip / TEST.PRG < prev    next >
Text File  |  1992-08-13  |  4KB  |  112 lines

  1. /*┌────────────────────────────────────────────────────────────────────────┐
  2.   │ Program Name: TEST.PRG          Copyright: Gallagher Computing Corp.   │▐                           
  3.   │ Date Created: 08/11/92           Language: Clipper 5.0                 │▐                      
  4.   │ Time Created: 00:39:14             Author: Kevin S Gallagher  .PRG     │▐
  5.   │ c:/brief/clipper.src               Author: Ben Echols         .ASM     │▐
  6.   │                                                                        │▐
  7.   │ If you like this function please send $5.00 (not required but helpful) │▐
  8.   │ Comments GOOD/BAD are always welcomed!                                 │▐
  9.   └────────────────────────────────────────────────────────────────────────┘▐
  10.    ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
  11. */
  12.  
  13. #include "grump.ch"
  14. #define usercmd
  15.  
  16. #xcommand TRYCLOCK  [ <var> ]       ;
  17.                     [ROW <nRow>]    ;
  18.                     [COL <nCol>]    ;
  19.                                  => ;
  20.                     [<var> :=] MCLOCK( <nRow>, <nCol>)
  21. function test
  22.     local x:=0, jj
  23.     GFSAVEENV(.T.,0,"W+/B")
  24.     dispbox(0,0,maxrow(),maxcol(),replicate(chr(177),9),"W+/B")
  25.     @0,0 say PADR(" ",80) color 'w+/gr'
  26.     EXBOX( 2, 4, 7, 54, 2, 20, , .T., "press any key to continue")
  27.     TRYCLOCK x ROW 0 COL 71                      //── Install clock
  28.     @3,6 say "BK_TICKINS( <nRow>, <nCol> ) -->nErrorLevel"     
  29.     @4,6 say "Installs the clock, using current screen colors" 
  30.     @5,6 say "ErrorLevel can be used for error checking clock" 
  31.     @6,6 say "nErrorlevel --> " + ltrim(str(x))
  32.     inkey(0)
  33.     TRYCLOCK ROW 99 COL 99                       //── Uninstall clock
  34.     scroll(3,5,6,53)
  35.     @0,0 say PADR(" ",80) color 'w+/rb'
  36.     WAITON("The time is now        ",.T.,"W+/GR",18)
  37.     TRYCLOCK ROW 19 COL 44                       //── Reinstall clock
  38.     @3,6 say "The clock was moved with the following code"
  39.     @4,6 say "               BK_TICKREM()"
  40.     @5,6 say "Both functions can be called in 1 line of code"
  41.     @6,6 say "As shown in the lower box.."
  42.     setcolor("W+/BG")
  43.     jj:=EXBOX( 12, 2, 14, 75, 2, 20, , .T., "press any key to continue")
  44.     @ 13,4 say "x := IF(nRow==NIL .OR. nCol==NIL,"+;
  45.                "BK_TICKREM(), BK_TICKINS(nRow, nCol))"
  46.     inkey(0)
  47.     BYEBYEBOX( jj )
  48.     inkey(1.1)
  49.     WAITOFF()
  50.     setcolor("W+/B")
  51.     TRYCLOCK ROW 99 COL 99                       //── Uninstall clock
  52.     TRYCLOCK x ROW 0 COL 71                      //── Reinstall clock
  53.     scroll(3,5,6,53)
  54.     @3,6 say "The clock was installed once again!"
  55.     @4,6 say "nErrorlevel --> " + ltrim(str(x))
  56.     @5,6 say "When ready press any key to Exit the demo"
  57.     inkey(0)
  58.     TRYCLOCK x ROW 99 COL 99                     //── Uninstall clock
  59.     GFRESTENV()
  60.     do case
  61.         case x = 100
  62.             @0,0 say PADR(" Clock uninstalled OKAY",80) color "W+/B"
  63.         case x = 97
  64.             @0,0 say PADR(" ERROR clock returned  97",80) color "W+/B"
  65.     endcase
  66. return nil
  67.  
  68. #ifdef Wimpy
  69. function CLOCK(nRow,nCol)
  70.     local nErrLevel := 102
  71.     do case
  72.         case nRow = NIL .AND. nCol = NIL
  73.             nErrLevel:=BK_TICKREM()              //── remove clock
  74.         case valtype(nRow) = "C" .OR. valtype(nCol) = "C"
  75.             return 102
  76.         case nRow >24
  77.             nErrLevel := 102
  78.         case nCol >72
  79.             nErrLevel := 102
  80.         case nCol>=0 .AND. nCol<=71 .AND. nRow>=0 .AND. nRow<=24
  81.             nErrLevel:=BK_TICKINS(nRow,nCol)     //── install clock
  82.     endcase
  83.     if nErrLevel=97 .OR. nErrLevel = 102
  84.         alert("   FATAL ERROR   ",{" REBOOT NOW "},"W+/B")
  85.     endif
  86. return nErrLevel
  87. #endif
  88.  
  89. #ifdef oneLiner
  90. function EXPERTCLOCK(nRow,nCol)
  91.     local x:=IF(nRow==NIL.OR.nCol==NIL,BK_TICKREM(),BK_TICKINS(nRow, nCol))
  92. return x
  93. #endif
  94.  
  95. #ifdef usercmd
  96. function MCLOCK(nRow,nCol)
  97.     local nErrLevel := 102
  98.     do case
  99.         case valtype(nRow) = "C" .OR. valtype(nCol) = "C"
  100.             return 101
  101.         case nRow = 99 .OR. nCol = 99
  102.             nErrLevel:= BK_TICKREM()
  103.         case nCol >= 0 .AND. nCol <= 71 .AND. nRow >= 0 .AND. nRow <= 24
  104.             nErrLevel := BK_TICKINS(nRow, nCol)
  105.     endcase
  106.     if nErrLevel=97 .OR. nErrLevel=1
  107.         alert("   FATAL ERROR   ",{" REBOOT NOW "},"W+/B")
  108.     endif
  109. return nErrLevel
  110. #endif
  111.  
  112.